
import { useEffect, useState } from "react"
const URL = 'http://geek.itheima.net/v1_0/channels'
function App() {
  const [list, setList] = useState([])
  useEffect(() => {
    async function getlist() {
      const res = await fetch(URL)
      const jsonRes = await res.json()
      console.log(jsonRes);

      setList(jsonRes.data.channels)
    }
    getlist()
  })
  return (
    <div>
      {list.map(item => <li key={item.id}>{item.name}</li>)}
    </div>
  )
}

export default App